"""
枚举类
"""

from enum import Enum,unique

# 方式一：简易形式，值为下标
Month = Enum('Month', ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'))
print(Month.Jan.value)

# 方式二：自定义值，@unique装饰器用来检测没有重复值
@unique
class Month(Enum):
    Jan = 1
    Feb = 2
    Mar = 3
    Apr = 4
    May = 5
    Jun = 6
    Jul = 7
    Aug = 8
    Sep = 9
    Oct = 10
    Nov = 11
    Dec = 12

    def __str__(self):
        return self.name
    
print(Month.Jan.value)
